export default {
  namespaced: true,
  state: {
    // 是否显示提示文本
    isShowToast: false,
    // 文本信息
    toastMsg: "注意",
    toastType: "",
  },
  mutations: {
    changeIsShowToast(state, payload) {
      state.isShowToast = payload.isShow;
      state.toastMsg = payload.msg;
      state.toastType = payload.type;
    },
  },
  actions: {
    asyncChangeIsShowToast({ commit }, payload) {
      commit("changeIsShowToast", {
        isShow: true,
        msg: payload.msg,
        type: payload.type,
      });
      setTimeout(() => {
        commit("changeIsShowToast", { isShow: false });
      }, 2000);
    },
  },
};
